<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a="http://topnet.it/facelets"
	xmlns:fn="http://topnet.it/functions"
	xmlns:rich="http://richfaces.ajax4jsf.org/rich"
	xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">

<ui:composition template="/WEB-INF/layout/t_single.xhtml">
	<ui:define name="title">Gestione Prenotazioni</ui:define>
	<ui:define name="content">
		<h2>Test</h2>

		<h:form id="form">
			<rich:panel id="prenotazioneScooter">
				<a:field id="scooter" label="Cilindrata:" type="selOneM"
					entityId="#{testHandler}" fieldName="cil"
					entityList="#{scootersHandler}" fieldNameList="cilindrateItems" />

				<a:field id="dataInit" label="Data Inizio(*):" fieldName="dal"
					type="calendar" entity="#{testHandler}" required="true" />

				<a:field id="dataEnd" label="Data Riconsegna(*):" fieldName="al"
					type="calendar" entity="#{testHandler}" required="true" />

				<a4j:commandButton id="cercaButton"
					action="#{testHandler.aggColonne}" value="cerca" reRender="cerca"
					immediate="false" />

			</rich:panel>
		</h:form>
		<h:form id="form2">
			<rich:panel id="cerca">
				<rich:dataTable id="colTable" value="#{testHandler.model}" var="res">
					<f:facet name="header">
						<h:outputText value="Test Prenotazioni"></h:outputText>
					</f:facet>
					<rich:columns value="#{testHandler.colonne}" var="col" index="ind"
						begin="#{testHandler.begin}" end="#{testHandler.end}">
						<f:facet name="header">
							<h:outputText value="#{col}" />
						</f:facet>
						<a4j:region>
							<a4j:commandLink value="#{res[ind].nome}"
								rendered="#{ind == '0'}" reRender="scooter,cerca" immediate="true">
								<a4j:actionparam name="id" value="#{res[ind].id}"
									assignTo="#{testHandler.scooter.id}" />
							</a4j:commandLink>
						</a4j:region>
						<h:outputText styleClass="#{res[ind].styleClass}"
							value="#{res[ind].symbol}" rendered="#{ind != '0'}" />
					</rich:columns>
				</rich:dataTable>

			</rich:panel>
		</h:form>

		<rich:panel id="scooter">
			<h:outputLabel for="sco" value="id scooter:" />
			<h:outputText id="sco" value="#{testHandler.scooter.id}" />
		</rich:panel>
	</ui:define>
</ui:composition>
</html>
